<?php
/**
 * 
 *  编辑城市名称 
 * 
 */

include('./config/db.php');
$pgdb = new PGDB;
// 1、获取前端发送的数据
if(isset($_POST) && !empty($_POST['id']&& !empty($_POST['city'] ))){
    // 2. 获取市的ID
    $id = $_POST['id'];
    $city = $_POST['city'];
    // 3. 修改市
    $edit_city_sql = "update public.management_t set name = '$city' where id =$id";
    $res = @$pgdb->query($edit_city_sql);
    // 4、返回结果
    if(!$res){
        die(json_encode(array('Code'=>0x000002,'Msg'=>'删除市失败')));
    }
    die(json_encode(array('Code'=>0x000000,'Msg'=>'删除市成功')));
}else{
    die(json_encode(array('Code'=>0x000001,'Msg'=>'没有数据上传')));
}